package resources;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class PropertiesLoader {
	/**
	 * 得到指定键的值
	 * @param key 配置属性键
	 * */
	public static String getConfigValue(String key) {
		FileInputStream fileInputStream;
		try {
			fileInputStream = new FileInputStream("src/resources/config.properties");
			BufferedInputStream in = new BufferedInputStream(fileInputStream);
			Properties p = new Properties();
			try {
				p.load(in);
				return p.getProperty(key);
			} catch (IOException e) {
				// TODO 自动生成的 catch 块
				e.printStackTrace();
			}
		} catch (FileNotFoundException e1) {
			// TODO 自动生成的 catch 块
			e1.printStackTrace();
		}
		return null;
	}
}
